<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>3 B | Glossary</title>
<meta name="author" content="psyTeachR Team">
<meta name="description" content="3.1 base R The set of R functions that come with a basic installation of R, before you add external packages Contrast with tidyverse.   3.2 beta distribution A family of distributions of data that...">
<meta name="generator" content="bookdown 0.24 with bs4_book()">
<meta property="og:title" content="3 B | Glossary">
<meta property="og:type" content="book">
<meta property="og:url" content="https://psyteachr.github.io/glossary/b.html">
<meta property="og:image" content="https://psyteachr.github.io/glossary/images/logos/logo.png">
<meta property="og:description" content="3.1 base R The set of R functions that come with a basic installation of R, before you add external packages Contrast with tidyverse.   3.2 beta distribution A family of distributions of data that...">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="3 B | Glossary">
<meta name="twitter:description" content="3.1 base R The set of R functions that come with a basic installation of R, before you add external packages Contrast with tidyverse.   3.2 beta distribution A family of distributions of data that...">
<meta name="twitter:image" content="https://psyteachr.github.io/glossary/images/logos/logo.png">
<!-- JS --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://kit.fontawesome.com/6ecbd6c532.js" crossorigin="anonymous"></script><script src="libs/header-attrs-2.11/header-attrs.js"></script><script src="libs/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="libs/bootstrap-4.6.0/bootstrap.min.css" rel="stylesheet">
<script src="libs/bootstrap-4.6.0/bootstrap.bundle.min.js"></script><script src="libs/bs3compat-0.3.1/transition.js"></script><script src="libs/bs3compat-0.3.1/tabs.js"></script><script src="libs/bs3compat-0.3.1/bs3compat.js"></script><link href="libs/bs4_book-1.0.0/bs4_book.css" rel="stylesheet">
<script src="libs/bs4_book-1.0.0/bs4_book.js"></script><script src="libs/kePrint-0.0.1/kePrint.js"></script><link href="libs/lightable-0.0.1/lightable.css" rel="stylesheet">
<!-- Global site tag (gtag.js) - Google Analytics --><script async src="https://www.googletagmanager.com/gtag/js?id=G-6NP3MF25W3"></script><script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-6NP3MF25W3');
    </script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- CSS --><link rel="stylesheet" href="include/psyteachr.css">
<link rel="stylesheet" href="include/webex.css">
<link rel="stylesheet" href="include/style.css">
</head>
<body data-spy="scroll" data-target="#toc">

<div class="container-fluid">
<div class="row">
  <header class="col-sm-12 col-lg-3 sidebar sidebar-book"><a class="sr-only sr-only-focusable" href="#content">Skip to main content</a>

    <div class="d-flex align-items-start justify-content-between">
      <h1>
        <a href="index.html" title="">Glossary</a>
      </h1>
      <button class="btn btn-outline-primary d-lg-none ml-2 mt-1" type="button" data-toggle="collapse" data-target="#main-nav" aria-expanded="true" aria-controls="main-nav"><i class="fas fa-bars"></i><span class="sr-only">Show table of contents</span></button>
    </div>

    <div id="main-nav" class="collapse-lg">
      <form role="search">
        <input id="search" class="form-control" type="search" placeholder="Search" aria-label="Search">
</form>

      <nav aria-label="Table of contents"><h2>Table of contents</h2>
        <ul class="book-toc list-unstyled">
<li><a class="" href="index.html">Overview</a></li>
<li><a class="" href="symbols.html"><span class="header-section-number">1</span> Symbols</a></li>
<li><a class="" href="a.html"><span class="header-section-number">2</span> A</a></li>
<li><a class="active" href="b.html"><span class="header-section-number">3</span> B</a></li>
<li><a class="" href="c.html"><span class="header-section-number">4</span> C</a></li>
<li><a class="" href="d.html"><span class="header-section-number">5</span> D</a></li>
<li><a class="" href="e.html"><span class="header-section-number">6</span> E</a></li>
<li><a class="" href="f.html"><span class="header-section-number">7</span> F</a></li>
<li><a class="" href="g.html"><span class="header-section-number">8</span> G</a></li>
<li><a class="" href="h.html"><span class="header-section-number">9</span> H</a></li>
<li><a class="" href="i.html"><span class="header-section-number">10</span> I</a></li>
<li><a class="" href="j.html"><span class="header-section-number">11</span> J</a></li>
<li><a class="" href="k.html"><span class="header-section-number">12</span> K</a></li>
<li><a class="" href="l.html"><span class="header-section-number">13</span> L</a></li>
<li><a class="" href="m.html"><span class="header-section-number">14</span> M</a></li>
<li><a class="" href="n.html"><span class="header-section-number">15</span> N</a></li>
<li><a class="" href="o.html"><span class="header-section-number">16</span> O</a></li>
<li><a class="" href="p.html"><span class="header-section-number">17</span> P</a></li>
<li><a class="" href="q.html"><span class="header-section-number">18</span> Q</a></li>
<li><a class="" href="r.html"><span class="header-section-number">19</span> R</a></li>
<li><a class="" href="s.html"><span class="header-section-number">20</span> S</a></li>
<li><a class="" href="t.html"><span class="header-section-number">21</span> T</a></li>
<li><a class="" href="u.html"><span class="header-section-number">22</span> U</a></li>
<li><a class="" href="v.html"><span class="header-section-number">23</span> V</a></li>
<li><a class="" href="w.html"><span class="header-section-number">24</span> W</a></li>
<li><a class="" href="x.html"><span class="header-section-number">25</span> X</a></li>
<li><a class="" href="y.html"><span class="header-section-number">26</span> Y</a></li>
<li><a class="" href="z.html"><span class="header-section-number">27</span> Z</a></li>
</ul>

        <div class="book-extra">
          <p><a id="book-repo" href="https://github.com/psyteachr/glossary">View book source <i class="fab fa-github"></i></a></p>
        </div>
      </nav>
</div>
  </header><main class="col-sm-12 col-md-9 col-lg-7" id="content"><div id="b" class="section level1" number="3">
<h1>
<span class="header-section-number">3</span> B<a class="anchor" aria-label="anchor" href="#b"><i class="fas fa-link"></i></a>
</h1>

<div id="base-r" class="section level2" number="3.1">
<h2>
<span class="header-section-number">3.1</span> base R<a class="anchor" aria-label="anchor" href="#base-r"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>The set of R <a href="f.html#function">functions</a> that come with a basic installation of R, before you add external <a href="p.html#package">packages</a></dfn></p>
<p>Contrast with <a href="t.html#tidyverse">tidyverse</a>.</p>

</div>
<div id="beta-distribution" class="section level2" number="3.2">
<h2>
<span class="header-section-number">3.2</span> beta distribution<a class="anchor" aria-label="anchor" href="#beta-distribution"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>A family of <a href="d.html#distribution">distributions</a> of data that are characterised by two <a href="p.html#paremeter">parameters</a>: α and β</dfn></p>
<p><a href="https://en.wikipedia.org/wiki/Beta_distribution" target="_blank">Wikipedia</a> actually has really good definitions and examples.</p>

</div>
<div id="beta" class="section level2" number="3.3">
<h2>
<span class="header-section-number">3.3</span> beta<a class="anchor" aria-label="anchor" href="#beta"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>The <a href="f.html#false-negative">false negative</a> rate we accept for a statistical test.</dfn></p>
<p>Beta is equal to 1 - <a href="p.html#power">power</a>, so if a test has power of 0.8 for a specific <a href="e.html#effect-size">effect size</a> and <a href="a.html#alpha-stats">alpha</a>, then beta = 0.2.</p>
<p>Beta can also refer to a parameter of the <a href="b.html#beta-distribution">beta distribution</a></p>

</div>
<div id="between-subjects" class="section level2" number="3.4">
<h2>
<span class="header-section-number">3.4</span> between subjects<a class="anchor" aria-label="anchor" href="#between-subjects"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>Not varying within unit of observation, such that each has only one value</dfn></p>
<p>For example, imagine an experiment where you test half of subjects in a dark room and the other half in a light. This experiment has one <a href="f.html#factor-experimental">factor</a>, room darkness, which is <strong>between subjects</strong> because each subject only experiences one <a href="l.html#level">level</a> of room darkness, not both. This experiment may also be described as "between subjects".</p>
<p>Contrast with <a href="w.html#within-subjects">within subjects</a>.</p>

</div>
<div id="bind_cols" class="section level2" number="3.5">
<h2>
<span class="header-section-number">3.5</span> bind_cols<a class="anchor" aria-label="anchor" href="#bind_cols"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>A <a href="b.html#binding-joins">binding join</a> that joins one table to another by adding their columns together</dfn></p>
<p><code>bind_cols</code> takes two tables with the same number of rows and adds the columns from the second table to the first.</p>
<div class="sourceCode" id="cb36"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">a</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://tibble.tidyverse.org/reference/tibble.html">tibble</a></span><span class="op">(</span>
  id <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fl">3</span>,
  x <span class="op">=</span> <span class="va">LETTERS</span><span class="op">[</span><span class="fl">1</span><span class="op">:</span><span class="fl">3</span><span class="op">]</span>
<span class="op">)</span>

<span class="va">b</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://tibble.tidyverse.org/reference/tibble.html">tibble</a></span><span class="op">(</span>
  y <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="cn">T</span>, <span class="cn">T</span>, <span class="cn">F</span><span class="op">)</span>
<span class="op">)</span>

<span class="va">data</span> <span class="op">&lt;-</span> <span class="fu">dplyr</span><span class="fu">::</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/bind.html">bind_cols</a></span><span class="op">(</span><span class="va">a</span>, <span class="va">b</span><span class="op">)</span></code></pre></div>
<div class="inline-table"><table class="table table-sm">
<thead><tr>
<th style="text-align:right;">
id
</th>
<th style="text-align:left;">
x
</th>
<th style="text-align:left;">
y
</th>
</tr></thead>
<tbody>
<tr>
<td style="text-align:right;">
1
</td>
<td style="text-align:left;">
A
</td>
<td style="text-align:left;">
TRUE
</td>
</tr>
<tr>
<td style="text-align:right;">
2
</td>
<td style="text-align:left;">
B
</td>
<td style="text-align:left;">
TRUE
</td>
</tr>
<tr>
<td style="text-align:right;">
3
</td>
<td style="text-align:left;">
C
</td>
<td style="text-align:left;">
FALSE
</td>
</tr>
</tbody>
</table></div>
<p>If any column has the same name in both tables, you will see a warning that the columns have been given new names.</p>
<div class="sourceCode" id="cb37"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">a</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://tibble.tidyverse.org/reference/tibble.html">tibble</a></span><span class="op">(</span>
  id <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fl">3</span>,
  x <span class="op">=</span> <span class="va">LETTERS</span><span class="op">[</span><span class="fl">1</span><span class="op">:</span><span class="fl">3</span><span class="op">]</span>
<span class="op">)</span>

<span class="va">b</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://tibble.tidyverse.org/reference/tibble.html">tibble</a></span><span class="op">(</span>
  x <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="cn">T</span>, <span class="cn">T</span>, <span class="cn">F</span><span class="op">)</span>
<span class="op">)</span>

<span class="va">data</span> <span class="op">&lt;-</span> <span class="fu">dplyr</span><span class="fu">::</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/bind.html">bind_cols</a></span><span class="op">(</span><span class="va">a</span>, <span class="va">b</span><span class="op">)</span>
<span class="co">#&gt; New names:</span>
<span class="co">#&gt; * x -&gt; x...2</span>
<span class="co">#&gt; * x -&gt; x...3</span></code></pre></div>
<div class="inline-table"><table class="table table-sm">
<thead><tr>
<th style="text-align:right;">
id
</th>
<th style="text-align:left;">
x...2
</th>
<th style="text-align:left;">
x...3
</th>
</tr></thead>
<tbody>
<tr>
<td style="text-align:right;">
1
</td>
<td style="text-align:left;">
A
</td>
<td style="text-align:left;">
TRUE
</td>
</tr>
<tr>
<td style="text-align:right;">
2
</td>
<td style="text-align:left;">
B
</td>
<td style="text-align:left;">
TRUE
</td>
</tr>
<tr>
<td style="text-align:right;">
3
</td>
<td style="text-align:left;">
C
</td>
<td style="text-align:left;">
FALSE
</td>
</tr>
</tbody>
</table></div>
<p>See <a href="j.html#joins">joins</a> for other types of joins and further resources.</p>

</div>
<div id="bind_rows" class="section level2" number="3.6">
<h2>
<span class="header-section-number">3.6</span> bind_rows<a class="anchor" aria-label="anchor" href="#bind_rows"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>A <a href="b.html#binding-joins">binding join</a> that joins one table to another by adding their rows together</dfn></p>
<p><code>bind_rows</code> takes two tables, finds all columns with the same name, and appends the second one to the first. If a column doesn't have a match in the other table, that columns' values are set to <a href="n.html#na">NA</a>.</p>
<div class="sourceCode" id="cb38"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">a</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://tibble.tidyverse.org/reference/tibble.html">tibble</a></span><span class="op">(</span>
  id <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fl">3</span>,
  x <span class="op">=</span> <span class="va">LETTERS</span><span class="op">[</span><span class="fl">1</span><span class="op">:</span><span class="fl">3</span><span class="op">]</span>,
  y <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="cn">T</span>, <span class="cn">T</span>, <span class="cn">F</span><span class="op">)</span>
<span class="op">)</span>

<span class="va">b</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://tibble.tidyverse.org/reference/tibble.html">tibble</a></span><span class="op">(</span>
  x <span class="op">=</span> <span class="va">LETTERS</span><span class="op">[</span><span class="fl">4</span><span class="op">:</span><span class="fl">6</span><span class="op">]</span>,
  id <span class="op">=</span> <span class="fl">4</span><span class="op">:</span><span class="fl">6</span>
<span class="op">)</span>

<span class="va">data</span> <span class="op">&lt;-</span> <span class="fu">dplyr</span><span class="fu">::</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/bind.html">bind_rows</a></span><span class="op">(</span><span class="va">a</span>, <span class="va">b</span><span class="op">)</span></code></pre></div>
<div class="inline-table"><table class="table table-sm">
<thead><tr>
<th style="text-align:right;">
id
</th>
<th style="text-align:left;">
x
</th>
<th style="text-align:left;">
y
</th>
</tr></thead>
<tbody>
<tr>
<td style="text-align:right;">
1
</td>
<td style="text-align:left;">
A
</td>
<td style="text-align:left;">
TRUE
</td>
</tr>
<tr>
<td style="text-align:right;">
2
</td>
<td style="text-align:left;">
B
</td>
<td style="text-align:left;">
TRUE
</td>
</tr>
<tr>
<td style="text-align:right;">
3
</td>
<td style="text-align:left;">
C
</td>
<td style="text-align:left;">
FALSE
</td>
</tr>
<tr>
<td style="text-align:right;">
4
</td>
<td style="text-align:left;">
D
</td>
<td style="text-align:left;">
NA
</td>
</tr>
<tr>
<td style="text-align:right;">
5
</td>
<td style="text-align:left;">
E
</td>
<td style="text-align:left;">
NA
</td>
</tr>
<tr>
<td style="text-align:right;">
6
</td>
<td style="text-align:left;">
F
</td>
<td style="text-align:left;">
NA
</td>
</tr>
</tbody>
</table></div>
<p>See <a href="j.html#joins">joins</a> for other types of joins and further resources.</p>

</div>
<div id="binding-joins" class="section level2" number="3.7">
<h2>
<span class="header-section-number">3.7</span> binding joins<a class="anchor" aria-label="anchor" href="#binding-joins"><i class="fas fa-link"></i></a>
</h2>
<p><dfn><a href="j.html#joins">Joins</a> that bind one table to another by adding their rows or columns together.</dfn></p>
<ul>
<li><a href="b.html#bind_rows">bind_rows</a></li>
<li><a href="b.html#bind_cols">bind_cols</a></li>
</ul>
</div>
<div id="binomial-distribution" class="section level2" number="3.8">
<h2>
<span class="header-section-number">3.8</span> binomial distribution<a class="anchor" aria-label="anchor" href="#binomial-distribution"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>The <a href="d.html#distribution">distribution</a> of data where each observation can have one of two outcomes, like success/failure, yes/no or head/tails. </dfn></p>
<div class="sourceCode" id="cb39"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># flip 10 coins 10000 times</span>
<span class="va">x</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/Binomial.html">rbinom</a></span><span class="op">(</span><span class="fl">10000</span>, <span class="fl">10</span>, prob <span class="op">=</span> <span class="fl">0.5</span><span class="op">)</span></code></pre></div>
<div class="figure" style="text-align: center">
<span style="display:block;" id="fig:binom-plot"></span>
<img src="_main_files/figure-html/binom-plot-1.png" alt="Binomial Distribution" width="100%"><p class="caption">
Figure 3.1: Binomial Distribution
</p>
</div>

</div>
<div id="bivariate-normal" class="section level2" number="3.9">
<h2>
<span class="header-section-number">3.9</span> bivariate normal<a class="anchor" aria-label="anchor" href="#bivariate-normal"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>Two <a href="n.html#normal-distribution">normally distributed</a> <a href="v.html#vector">vectors</a> that have a specified <a href="c.html#correlation">correlation</a> with each other.</dfn></p>
<p>You can use the {<a href="https://debruine.github.io/faux" target="_blank">faux</a>} package to quickly create variables from a bivariate normal distribution with a specified correlation.</p>
<div class="sourceCode" id="cb40"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data</span> <span class="op">&lt;-</span> <span class="fu">faux</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/pkg/faux/man/rnorm_multi.html">rnorm_multi</a></span><span class="op">(</span>
  n <span class="op">=</span> <span class="fl">10000</span>, vars <span class="op">=</span> <span class="fl">2</span>, 
  mu <span class="op">=</span> <span class="fl">0</span>, sd <span class="op">=</span> <span class="fl">1</span>, r <span class="op">=</span> <span class="fl">0.5</span>,
  varnames <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="st">"x"</span>, <span class="st">"y"</span><span class="op">)</span>
<span class="op">)</span></code></pre></div>
<div class="figure" style="text-align: center">
<span style="display:block;" id="fig:bvn-plot"></span>
<img src="_main_files/figure-html/bvn-plot-1.png" alt="A bivariate normal distribution where both variables have mu = 0 and SD = 1, with r = 0.5" width="100%"><p class="caption">
Figure 3.2: A bivariate normal distribution where both variables have mu = 0 and SD = 1, with r = 0.5
</p>
</div>

</div>
<div id="block" class="section level2" number="3.10">
<h2>
<span class="header-section-number">3.10</span> block<a class="anchor" aria-label="anchor" href="#block"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>A section of code in an <a href="r.html#r-markdown">R Markdown</a> file</dfn></p>
<p>See <a href="c.html#chunk">chunk</a>.</p>

</div>
<div id="boolean-expression" class="section level2" number="3.11">
<h2>
<span class="header-section-number">3.11</span> boolean expression<a class="anchor" aria-label="anchor" href="#boolean-expression"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>An expression that evaluates to TRUE or FALSE.</dfn></p>
<p>Boolean expressions usually use a relational <a href="o.html#operator">operator</a>, such as <code><a href="https://rdrr.io/r/base/Comparison.html">==</a></code> or <code><a href="https://rdrr.io/r/base/Comparison.html">&gt;</a></code> to compare two values.</p>
<div class="sourceCode" id="cb41"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># ==    Equal to    </span>
<span class="fl">1</span> <span class="op">==</span> <span class="fl">1</span>
<span class="co">#&gt; [1] TRUE</span>
<span class="fl">1</span> <span class="op">==</span> <span class="fl">2</span>
<span class="co">#&gt; [1] FALSE</span></code></pre></div>
<div class="sourceCode" id="cb42"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># !=    Not equal to    </span>
<span class="fl">1</span> <span class="op">!=</span> <span class="fl">2</span>
<span class="co">#&gt; [1] TRUE</span>
<span class="fl">1</span> <span class="op">!=</span> <span class="fl">1</span>
<span class="co">#&gt; [1] FALSE</span></code></pre></div>
<div class="sourceCode" id="cb43"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># &gt;     Greater than</span>
<span class="fl">2</span> <span class="op">&gt;</span> <span class="fl">1</span>
<span class="co">#&gt; [1] TRUE</span>
<span class="fl">1</span> <span class="op">&gt;</span> <span class="fl">2</span>
<span class="co">#&gt; [1] FALSE</span></code></pre></div>
<div class="sourceCode" id="cb44"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># &gt;=    Greater than or equal to</span>
<span class="fl">2</span> <span class="op">&gt;=</span> <span class="fl">1</span>
<span class="co">#&gt; [1] TRUE</span>
<span class="fl">1</span> <span class="op">&gt;=</span> <span class="fl">2</span>
<span class="co">#&gt; [1] FALSE</span></code></pre></div>
<div class="sourceCode" id="cb45"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># &lt;     Less than</span>
<span class="fl">1</span> <span class="op">&lt;</span> <span class="fl">2</span>
<span class="co">#&gt; [1] TRUE</span>
<span class="fl">2</span> <span class="op">&lt;</span> <span class="fl">1</span>
<span class="co">#&gt; [1] FALSE</span></code></pre></div>
<div class="sourceCode" id="cb46"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># &lt;=    Less than or equal to</span>
<span class="fl">1</span> <span class="op">&lt;=</span> <span class="fl">2</span>
<span class="co">#&gt; [1] TRUE</span>
<span class="fl">2</span> <span class="op">&lt;=</span> <span class="fl">1</span>
<span class="co">#&gt; [1] FALSE</span></code></pre></div>
<div class="sourceCode" id="cb47"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># %in%  Match operator  </span>
<span class="st">"A"</span> <span class="op">%in%</span> <span class="va">LETTERS</span>
<span class="co">#&gt; [1] TRUE</span>
<span class="st">"1"</span> <span class="op">%in%</span> <span class="va">LETTERS</span>
<span class="co">#&gt; [1] FALSE</span></code></pre></div>

</div>
<div id="boolean" class="section level2" number="3.12">
<h2>
<span class="header-section-number">3.12</span> boolean<a class="anchor" aria-label="anchor" href="#boolean"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>A <a href="d.html#data-type">data type</a> representing <code>TRUE</code> or <code>FALSE</code> values.</dfn></p>
<p>Typically called <a href="l.html#logical">logical</a> in R.</p>

</div>
<div id="bootstrap" class="section level2" number="3.13">
<h2>
<span class="header-section-number">3.13</span> bootstrap<a class="anchor" aria-label="anchor" href="#bootstrap"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>Resampling with replacement.</dfn></p>
<p>In statistics, bootstrapping is used to resample with replacement from an original small sample. This allows us to calculate confidence intervals for any estimate.</p>
<ul>
<li><a href="https://towardsdatascience.com/a-practical-guide-to-bootstrap-with-r-examples-bd975ec6dcea">A Practical Guide to the Bootstrap in R</a></li>
<li><a href="https://www.statmethods.net/advstats/bootstrapping.html">Bootstrapping by Quick-R</a></li>
</ul>
</div>
<div id="brackets" class="section level2" number="3.14">
<h2>
<span class="header-section-number">3.14</span> brackets<a class="anchor" aria-label="anchor" href="#brackets"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>Square brackets used to subset a <a href="c.html#container">container</a> like a <a href="v.html#vector">vector</a>, <a href="l.html#list">list</a>, <a href="d.html#data-frame">data frame</a>, or <a href="m.html#matrix">matrix</a> (e.g., mtcars[[1]] or mtcars[1:2]).</dfn></p>
<p>When you use <a href="s.html#single-brackets">single brackets</a> to subset a container, you get back a container with the items you selected. This contrasts with <a href="d.html#double-brackets">double brackets</a>, which only return a single item in the container.</p>
<p>You can use single brackets to select one or more items from a vector.</p>
<div class="sourceCode" id="cb48"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">secret_code</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="fl">16</span>, <span class="fl">19</span>, <span class="fl">25</span>, <span class="fl">20</span>, <span class="fl">5</span>, <span class="fl">1</span>, <span class="fl">3</span>, <span class="fl">8</span>, <span class="fl">18</span><span class="op">)</span>

<span class="va">LETTERS</span><span class="op">[</span><span class="va">secret_code</span><span class="op">]</span>
<span class="co">#&gt; [1] "P" "S" "Y" "T" "E" "A" "C" "H" "R"</span></code></pre></div>
<p>If you use double brackets, you can only select a single item from the vector. If you try to select more than one, you will get the following error messge.</p>
<div class="sourceCode" id="cb49"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">LETTERS</span><span class="op">[[</span><span class="va">secret_code</span><span class="op">]</span><span class="op">]</span>
<span class="co">#&gt; Error in LETTERS[[secret_code]]: attempt to select more than one element in vectorIndex</span></code></pre></div>
<p>You can select items by <a href="i.html#index">index</a> or name. <code>mylist[c("a", "c")]</code> returns a list containing the first and third items.</p>
<div class="sourceCode" id="cb50"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">mylist</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span>
  a <span class="op">=</span> <span class="fl">10</span>,
  b <span class="op">=</span> <span class="fl">20</span>,
  c <span class="op">=</span> <span class="fl">30</span>
<span class="op">)</span>

<span class="va">mylist</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="st">"a"</span>, <span class="st">"c"</span><span class="op">)</span><span class="op">]</span>
<span class="co">#&gt; $a</span>
<span class="co">#&gt; [1] 10</span>
<span class="co">#&gt; </span>
<span class="co">#&gt; $c</span>
<span class="co">#&gt; [1] 30</span></code></pre></div>
<p>Single brackets return the same type of container as the <a href="o.html#object">object</a> being subset, so <code>mylist[1]</code> returns a <a href="l.html#list">list</a> containing just the first item.</p>
<div class="sourceCode" id="cb51"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">mylist</span><span class="op">[</span><span class="fl">1</span><span class="op">]</span>
<span class="co">#&gt; $a</span>
<span class="co">#&gt; [1] 10</span></code></pre></div>
<p>Double brackets return the same type of object as the single item being selected, so <code>mylist[[1]]</code> returns a <a href="v.html#vector">vector</a> that is the same as the first item in <code>mylist</code>.</p>
<div class="sourceCode" id="cb52"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">mylist</span><span class="op">[[</span><span class="fl">1</span><span class="op">]</span><span class="op">]</span>
<span class="co">#&gt; [1] 10</span></code></pre></div>
<p>Single brackets let you select rows and columns of a <a href="d.html#data-frame">data frame</a> or <a href="t.html#tibble">tibble</a>, if you separate them by a comma.</p>
<div class="sourceCode" id="cb53"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op">(</span>
  id <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fl">3</span>,
  letter <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="st">"a"</span>, <span class="st">"b"</span>, <span class="st">"c"</span><span class="op">)</span>,
  vowel <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="cn">TRUE</span>, <span class="cn">FALSE</span>, <span class="cn">FALSE</span><span class="op">)</span>
<span class="op">)</span>

<span class="co"># rows 1:2 and columns 3:4</span>
<span class="va">data</span><span class="op">[</span><span class="fl">1</span><span class="op">:</span><span class="fl">2</span>, <span class="fl">2</span><span class="op">:</span><span class="fl">3</span><span class="op">]</span></code></pre></div>
<div class="kable-table">
<div class="inline-table"><table class="table table-sm">
<thead><tr>
<th style="text-align:left;">
letter
</th>
<th style="text-align:left;">
vowel
</th>
</tr></thead>
<tbody>
<tr>
<td style="text-align:left;">
a
</td>
<td style="text-align:left;">
TRUE
</td>
</tr>
<tr>
<td style="text-align:left;">
b
</td>
<td style="text-align:left;">
FALSE
</td>
</tr>
</tbody>
</table></div>
</div>
<p>If you omit the rows or columns, you select them all.</p>
<div class="sourceCode" id="cb54"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data</span><span class="op">[</span><span class="fl">1</span>, <span class="op">]</span> <span class="co"># row 1, all columns</span></code></pre></div>
<div class="kable-table">
<div class="inline-table"><table class="table table-sm">
<thead><tr>
<th style="text-align:right;">
id
</th>
<th style="text-align:left;">
letter
</th>
<th style="text-align:left;">
vowel
</th>
</tr></thead>
<tbody><tr>
<td style="text-align:right;">
1
</td>
<td style="text-align:left;">
a
</td>
<td style="text-align:left;">
TRUE
</td>
</tr></tbody>
</table></div>
</div>
<div class="sourceCode" id="cb55"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data</span><span class="op">[</span>, <span class="fl">1</span><span class="op">:</span><span class="fl">2</span><span class="op">]</span> <span class="co"># all rows, columns 1:2</span></code></pre></div>
<div class="kable-table">
<div class="inline-table"><table class="table table-sm">
<thead><tr>
<th style="text-align:right;">
id
</th>
<th style="text-align:left;">
letter
</th>
</tr></thead>
<tbody>
<tr>
<td style="text-align:right;">
1
</td>
<td style="text-align:left;">
a
</td>
</tr>
<tr>
<td style="text-align:right;">
2
</td>
<td style="text-align:left;">
b
</td>
</tr>
<tr>
<td style="text-align:right;">
3
</td>
<td style="text-align:left;">
c
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="warning">
<p>If you only select one column of a data frame with single brackets, you will get a vector back instead of a data frame. You can change this behaviour by using <code>drop = FALSE</code>.</p>
<div class="sourceCode" id="cb56"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data</span><span class="op">[</span>, <span class="fl">1</span><span class="op">]</span> <span class="co"># returns a vector</span>
<span class="co">#&gt; [1] 1 2 3</span></code></pre></div>
<div class="sourceCode" id="cb57"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data</span><span class="op">[</span>, <span class="fl">1</span>, drop <span class="op">=</span> <span class="cn">FALSE</span><span class="op">]</span> <span class="co"># returns a data frame</span></code></pre></div>
<div class="kable-table">
<div class="inline-table"><table class="table table-sm">
<thead><tr>
<th style="text-align:right;">
id
</th>
</tr></thead>
<tbody>
<tr>
<td style="text-align:right;">
1
</td>
</tr>
<tr>
<td style="text-align:right;">
2
</td>
</tr>
<tr>
<td style="text-align:right;">
3
</td>
</tr>
</tbody>
</table></div>
</div>
<p><a href="t.html#tibble">Tibbles</a> always returns a tibble.</p>
<div class="sourceCode" id="cb58"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://tibble.tidyverse.org/reference/as_tibble.html">as_tibble</a></span><span class="op">(</span><span class="va">data</span><span class="op">)</span><span class="op">[</span>, <span class="fl">1</span><span class="op">]</span> <span class="co"># returns a tibble</span></code></pre></div>
<div class="kable-table">
<div class="inline-table"><table class="table table-sm">
<thead><tr>
<th style="text-align:right;">
id
</th>
</tr></thead>
<tbody>
<tr>
<td style="text-align:right;">
1
</td>
</tr>
<tr>
<td style="text-align:right;">
2
</td>
</tr>
<tr>
<td style="text-align:right;">
3
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
<p>Double brackets can be used with a single index or name to select a column as a vector.</p>
<div class="sourceCode" id="cb59"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data</span><span class="op">[[</span><span class="st">"vowel"</span><span class="op">]</span><span class="op">]</span>
<span class="co">#&gt; [1]  TRUE FALSE FALSE</span></code></pre></div>
<p>Or with row and column values to select a single cell.</p>
<div class="sourceCode" id="cb60"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data</span><span class="op">[[</span><span class="fl">1</span>, <span class="st">"vowel"</span><span class="op">]</span><span class="op">]</span>
<span class="co">#&gt; [1] TRUE</span></code></pre></div>
<p>You can't use double brackets to select a single row of a data table.</p>
<div class="sourceCode" id="cb61"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data</span><span class="op">[[</span><span class="fl">1</span>, <span class="op">]</span><span class="op">]</span>
<span class="co">#&gt; Error in `[[.data.frame`(data, 1, ): argument "..2" is missing, with no default</span></code></pre></div>
<p>More complex containers like 3-dimensional <a href="a.html#array">arrays</a> can have more than 2 values in the brackets, but work on the same principles.</p>
<div class="sourceCode" id="cb62"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">myarray</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/array.html">array</a></span><span class="op">(</span><span class="fl">1</span><span class="op">:</span><span class="fl">8</span>, dim <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="fl">2</span>, <span class="fl">2</span>, <span class="fl">2</span><span class="op">)</span><span class="op">)</span>
<span class="va">myarray</span><span class="op">[</span><span class="fl">2</span>, <span class="fl">2</span>, <span class="fl">2</span><span class="op">]</span>
<span class="co">#&gt; [1] 8</span></code></pre></div>

</div>
</div>
<script>

/* update total correct if #webex-total_correct exists */
update_total_correct = function() {
  console.log("webex: update total_correct");

  if (t = document.getElementById("webex-total_correct")) {
    var correct = document.getElementsByClassName("webex-correct").length;
    var solvemes = document.getElementsByClassName("webex-solveme").length;
    var radiogroups = document.getElementsByClassName("webex-radiogroup").length;
    var selects = document.getElementsByClassName("webex-select").length;
    
    t.innerHTML = correct + " of " + (solvemes + radiogroups + selects) + " correct";
  }
}

/* webex-solution button toggling function */
b_func = function() {
  console.log("webex: toggle hide");
  
  var cl = this.parentElement.classList;
  if (cl.contains('open')) {
    cl.remove("open");
  } else {
    cl.add("open");
  }
}

/* function for checking solveme answers */
solveme_func = function(e) {
  console.log("webex: check solveme");

  var real_answers = JSON.parse(this.dataset.answer);
  var my_answer = this.value;
  var cl = this.classList;
  if (cl.contains("ignorecase")) {
    my_answer = my_answer.toLowerCase();
  }
  if (cl.contains("nospaces")) {
    my_answer = my_answer.replace(/ /g, "")
  }

  if (my_answer == "") {
    cl.remove("webex-correct");
    cl.remove("webex-incorrect");
  } else if (real_answers.includes(my_answer)) {
    cl.add("webex-correct");
    cl.remove("webex-incorrect");
  } else {
    cl.add("webex-incorrect");
    cl.remove("webex-correct");
  }

  // match numeric answers within a specified tolerance
  if(this.dataset.tol > 0){
    var tol = JSON.parse(this.dataset.tol);
    var matches = real_answers.map(x => Math.abs(x - my_answer) < tol)
    if (matches.reduce((a, b) => a + b, 0) > 0) {
      cl.add("webex-correct");
    } else {
      cl.remove("webex-correct");
    }
  }

  // added regex bit
  if (cl.contains("regex")){
    answer_regex = RegExp(real_answers.join("|"))
    if (answer_regex.test(my_answer)) {
      cl.add("webex-correct");
    }
  }

  update_total_correct();
}

/* function for checking select answers */
select_func = function(e) {
  console.log("webex: check select");
  
  var cl = this.classList
  
  /* add style */
  cl.remove("webex-incorrect");
  cl.remove("webex-correct");
  if (this.value == "answer") {
    cl.add("webex-correct");
  } else if (this.value != "blank") {
    cl.add("webex-incorrect");
  }
  
  update_total_correct();
}

/* function for checking radiogroups answers */
radiogroups_func = function(e) {
  console.log("webex: check radiogroups");

  var checked_button = document.querySelector('input[name=' + this.id + ']:checked');
  var cl = checked_button.parentElement.classList;
  var labels = checked_button.parentElement.parentElement.children;
  
  /* get rid of styles */
  for (i = 0; i < labels.length; i++) {
    labels[i].classList.remove("webex-incorrect");
    labels[i].classList.remove("webex-correct");
  }
  
  /* add style */
  if (checked_button.value == "answer") {
    cl.add("webex-correct");
  } else {
    cl.add("webex-incorrect");
  }
  
  update_total_correct();
}

window.onload = function() {
  console.log("onload");
  /* set up solution buttons */
  var buttons = document.getElementsByTagName("button");

  for (var i = 0; i < buttons.length; i++) {
    if (buttons[i].parentElement.classList.contains('webex-solution')) {
      buttons[i].onclick = b_func;
    }
  }

  /* set up webex-solveme inputs */
  var solveme = document.getElementsByClassName("webex-solveme");

  for (var i = 0; i < solveme.length; i++) {
    /* make sure input boxes don't auto-anything */
    solveme[i].setAttribute("autocomplete","off");
    solveme[i].setAttribute("autocorrect", "off");
    solveme[i].setAttribute("autocapitalize", "off");
    solveme[i].setAttribute("spellcheck", "false");
    solveme[i].value = "";

    /* adjust answer for ignorecase or nospaces */
    var cl = solveme[i].classList;
    var real_answer = solveme[i].dataset.answer;
    if (cl.contains("ignorecase")) {
      real_answer = real_answer.toLowerCase();
    }
    if (cl.contains("nospaces")) {
      real_answer = real_answer.replace(/ /g, "");
    }
    solveme[i].dataset.answer = real_answer;

    /* attach checking function */
    solveme[i].onkeyup = solveme_func;
    solveme[i].onchange = solveme_func;
  }
  
  /* set up radiogroups */
  var radiogroups = document.getElementsByClassName("webex-radiogroup");
  for (var i = 0; i < radiogroups.length; i++) {
    radiogroups[i].onchange = radiogroups_func;
  }
  
  /* set up selects */
  var selects = document.getElementsByClassName("webex-select");
  for (var i = 0; i < selects.length; i++) {
    selects[i].onchange = select_func;
  }

  update_total_correct();
}

</script><script>
$( document ).ready(function() {
  var cite = ' ';
  var psyteachr = ' <a href="https://psyteachr.github.io/"><img src="images/logos/psyteachr_logo.png" style="height: 31px; color: white;" alt="psyTeachR: Reproducible Research" /></a>';
  var license = ' <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/" target="blank"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png"></a>';

  $("footer div.row div:eq(1) p").html(
    psyteachr + license + cite
  );
  
  $("#toc").appendTo($("#main-nav"));
});
</script><div class="chapter-nav">
<div class="prev"><a href="a.html"><span class="header-section-number">2</span> A</a></div>
<div class="next"><a href="c.html"><span class="header-section-number">4</span> C</a></div>
</div></main><div class="col-md-3 col-lg-2 d-none d-md-block sidebar sidebar-chapter">
    <nav id="toc" data-toggle="toc" aria-label="On this page"><h2>On this page</h2>
      <ul class="nav navbar-nav">
<li><a class="nav-link" href="#b"><span class="header-section-number">3</span> B</a></li>
<li><a class="nav-link" href="#base-r"><span class="header-section-number">3.1</span> base R</a></li>
<li><a class="nav-link" href="#beta-distribution"><span class="header-section-number">3.2</span> beta distribution</a></li>
<li><a class="nav-link" href="#beta"><span class="header-section-number">3.3</span> beta</a></li>
<li><a class="nav-link" href="#between-subjects"><span class="header-section-number">3.4</span> between subjects</a></li>
<li><a class="nav-link" href="#bind_cols"><span class="header-section-number">3.5</span> bind_cols</a></li>
<li><a class="nav-link" href="#bind_rows"><span class="header-section-number">3.6</span> bind_rows</a></li>
<li><a class="nav-link" href="#binding-joins"><span class="header-section-number">3.7</span> binding joins</a></li>
<li><a class="nav-link" href="#binomial-distribution"><span class="header-section-number">3.8</span> binomial distribution</a></li>
<li><a class="nav-link" href="#bivariate-normal"><span class="header-section-number">3.9</span> bivariate normal</a></li>
<li><a class="nav-link" href="#block"><span class="header-section-number">3.10</span> block</a></li>
<li><a class="nav-link" href="#boolean-expression"><span class="header-section-number">3.11</span> boolean expression</a></li>
<li><a class="nav-link" href="#boolean"><span class="header-section-number">3.12</span> boolean</a></li>
<li><a class="nav-link" href="#bootstrap"><span class="header-section-number">3.13</span> bootstrap</a></li>
<li><a class="nav-link" href="#brackets"><span class="header-section-number">3.14</span> brackets</a></li>
</ul>

      <div class="book-extra">
        <ul class="list-unstyled">
<li><a id="book-source" href="https://github.com/psyteachr/glossary/blob/master/terms/b.Rmd">View source <i class="fab fa-github"></i></a></li>
          <li><a id="book-edit" href="https://github.com/psyteachr/glossary/edit/master/terms/b.Rmd">Edit this page <i class="fab fa-github"></i></a></li>
        </ul>
</div>
    </nav>
</div>

</div>
</div> <!-- .container -->

<footer class="bg-primary text-light mt-5"><div class="container"><div class="row">

  <div class="col-12 col-md-6 mt-3">
    <p>"<strong>Glossary</strong>" was written by psyTeachR Team. It was last built on 2022-02-10.</p>
  </div>

  <div class="col-12 col-md-6 mt-3">
    <p>This book was built by the <a class="text-light" href="https://bookdown.org">bookdown</a> R package.</p>
  </div>

</div></div>
</footer><!-- dynamically load mathjax for compatibility with self-contained --><script>
  (function () {
    var script = document.createElement("script");
    script.type = "text/javascript";
    var src = "true";
    if (src === "" || src === "true") src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML";
    if (location.protocol !== "file:")
      if (/^https?:/.test(src))
        src = src.replace(/^https?:/, '');
    script.src = src;
    document.getElementsByTagName("head")[0].appendChild(script);
  })();
</script><script type="text/x-mathjax-config">const popovers = document.querySelectorAll('a.footnote-ref[data-toggle="popover"]');
for (let popover of popovers) {
  const div = document.createElement('div');
  div.setAttribute('style', 'position: absolute; top: 0, left:0; width:0, height:0, overflow: hidden; visibility: hidden;');
  div.innerHTML = popover.getAttribute('data-content');

  var has_math = div.querySelector("span.math");
  if (has_math) {
    document.body.appendChild(div);
    MathJax.Hub.Queue(["Typeset", MathJax.Hub, div]);
    MathJax.Hub.Queue(function() {
      popover.setAttribute('data-content', div.innerHTML);
      document.body.removeChild(div);
    })
  }
}
</script>
</body>
</html>
